package com.wn.controller;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.wn.entity.RbacManager;
import com.wn.service.RbacManagerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/rbacManager")
public class RbacManagerController {
    @Autowired(required = false)
    RbacManagerService rbacManagerservice;
    @GetMapping("/findOne/{id}")
    public RbacManager findOne(@PathVariable int id){
        return rbacManagerservice.findOne(id);
    }

//    /**
//     * 分页查询所有的数据
//     * @return
//     */
//    @GetMapping("/findAll/{startPage}/{pageSize}")
//    public PageInfo<RbacManager> findAll(@PathVariable("startPage") int startPage, @PathVariable("pageSize") int pageSize){
//        PageHelper.startPage(startPage, pageSize);
//        List<RbacManager> managerList = rbacManagerservice.findAll();
//        PageInfo<RbacManager> rbacManagerPageInfo = new PageInfo<>(managerList);
//        return  rbacManagerPageInfo;
//    }
////    *//**
////     * 分页查询所有的数据,最终版，通过ResponseEntity对返回对象再一次封装！
////     * @return
////     *//*
//    @GetMapping("/findAllResponse/{startPage}/{pageSize}")
//    public ResponseEntity<PageInfo<RbacManager>> findAllRes(@PathVariable("startPage") int startPage, @PathVariable("pageSize") int pageSize){
//        PageHelper.startPage(startPage, pageSize);
//        List<RbacManager> managerList = rbacManagerservice.findAll();
//        PageInfo<RbacManager> rbacManagerPageInfo = new PageInfo<>(managerList);
//        return new ResponseEntity(200, "查询成功！", rbacManagerPageInfo);
//    }
}
